Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor FlightRecorderInputStream Class #10008

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

matheusbus
Copy link

Pull Request - Refactor FlightRecorderInputStream Class

Summary of the Change

This pull request refactors the FlightRecorderInputStream class by simplifying the analyzeCrash method. The method, which previously included complex logic for thread creation, has been refactored to delegate the thread creation into a new private method called createDiagnosisThread. This change improves the method's readability and maintainability, without altering its functionality.

Code Smell Identified:

  • The analyzeCrash method was identified as having a high level of complexity, with the logic for thread creation embedded directly in the method.

Refactoring Method:

  • Extract Method: The logic for creating and initializing the thread was extracted into a new method called createDiagnosisThread to simplify the analyzeCrash method.

Benefits:

  • Readability: The analyzeCrash method is now cleaner and more focused on its primary responsibilities.
  • Reusability: The new createDiagnosisThread method can be reused if thread creation is needed elsewhere in the code.

Testing Done

  • Manual Testing:

    • The refactor has been manually tested by verifying that the functionality of the FlightRecorderInputStream class remains intact.
    • The thread creation behavior has been preserved, and the refactor improves code structure without altering functionality.
  • Automated Testing:

    • No new automated tests were added as part of this refactor. However, the code was exercised manually to confirm that the changes did not break existing functionality.

Proposed Changelog Entries

  • Simplified the analyzeCrash method by extracting thread creation logic into a new helper method, createDiagnosisThread.

Proposed Upgrade Guidelines

N/A


Submitter Checklist

  • The Jira issue, if it exists, is well-described.
  • The changelog entries and upgrade guidelines are appropriate and written in the imperative mood.
  • The change has been manually tested, and the behavior has been verified.
  • No new public classes or methods require additional annotations.
  • No new deprecations have been introduced.
  • New or changed JavaScript does not use inline definitions or eval.
  • For dependency updates, relevant changelogs have been linked.
  • For new APIs, at least one consumer is referenced.

Desired Reviewers

  • @jenkinsci/core-pr-reviewers

Maintainer Checklist

  • There are at least two approvals for the pull request.
  • All conversations in the pull request are resolved.
  • The changelog entries are accurate and in the imperative mood.
  • Proper changelog labels have been set.
  • If the change needs additional upgrade steps, the upgrade-guide-needed label is set.
  • If this change should be backported to LTS, a Jira issue has been created with the lts-candidate label.

Copy link

welcome bot commented Nov 28, 2024

Yay, your first pull request towards Jenkins core was created successfully! Thank you so much!

A contributor will provide feedback soon. Meanwhile, you can join the chats and community forums to connect with other Jenkins users, developers, and maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant